package com.cnbm.wcsbasic.dispatch.enums.line.plc1;


import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.api.DaveArea;
import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.type.PlcVar;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2023/2/21 19:35
 */
public enum Plc2WcsVar {

    //12001   开始
    RW_FLAG_12001("RW_FLAG_12001", PlcVar.BYTE,1, DaveArea.DB,2,0,0),
    EQ_STATUS_12001("EQ_STATUS_12001", PlcVar.BYTE,1, DaveArea.DB,2,1,0),
    TASK_NO_12001("TASK_NO_12001", PlcVar.INT,1, DaveArea.DB,2,2,0),
    IS_STOCK_12001("IS_STOCK_12001", PlcVar.BOOL,1, DaveArea.DB,2,6,0),
    IS_HEIGHT_12001("IS_HEIGHT_12001", PlcVar.BOOL,1, DaveArea.DB,2,6,1),
    BARCODE_READ_COMP_12001("BARCODE_READ_COMP_12001", PlcVar.BOOL,1, DaveArea.DB,2,7,1),
    READED_CODE_12001("READED_CODE_12001", PlcVar.STRING,1, DaveArea.DB,2,14,6),
    //12001   结束


    //12002   开始
    RW_FLAG_12002("RW_FLAG_12002", PlcVar.BYTE,1, DaveArea.DB,2,30,0),
    EQ_STATUS_12002("EQ_STATUS_12002", PlcVar.BYTE,1, DaveArea.DB,2,31,0),
    TASK_NO_12002("TASK_NO_12002", PlcVar.INT,1, DaveArea.DB,2,32,0),
    IS_STOCK_12002("IS_STOCK_12002", PlcVar.BOOL,1, DaveArea.DB,2,36,0),
    IS_HEIGHT_12002("IS_HEIGHT_12002", PlcVar.BOOL,1, DaveArea.DB,2,36,1),
    BARCODE_READ_COMP_12002("BARCODE_READ_COMP_12002", PlcVar.BOOL,1, DaveArea.DB,2,37,1),
    READED_CODE_12002("READED_CODE_12002", PlcVar.STRING,1, DaveArea.DB,2,44,6),
    //12002   结束

    //12003   开始
    RW_FLAG_12003("RW_FLAG_12003", PlcVar.BYTE,1, DaveArea.DB,2,60,0),
    EQ_STATUS_12003("EQ_STATUS_12003", PlcVar.BYTE,1, DaveArea.DB,2,61,0),
    TASK_NO_12003("TASK_NO_12003", PlcVar.INT,1, DaveArea.DB,2,62,0),
    IS_STOCK_12003("IS_STOCK_12003", PlcVar.BOOL,1, DaveArea.DB,2,66,0),
    IS_HEIGHT_12003("IS_HEIGHT_12003", PlcVar.BOOL,1, DaveArea.DB,2,66,1),
    BARCODE_READ_COMP_12003("BARCODE_READ_COMP_12003", PlcVar.BOOL,1, DaveArea.DB,2,67,1),
    READED_CODE_12003("READED_CODE_12003", PlcVar.STRING,1, DaveArea.DB,2,74,6),
    //12003   结束


    //12004   开始
    RW_FLAG_12004("RW_FLAG_12004", PlcVar.BYTE,1, DaveArea.DB,2,90,0),
    EQ_STATUS_12004("EQ_STATUS_12004", PlcVar.BYTE,1, DaveArea.DB,2,91,0),
    TASK_NO_12004("TASK_NO_12004", PlcVar.INT,1, DaveArea.DB,2,92,0),
    IS_STOCK_12004("IS_STOCK_12004", PlcVar.BOOL,1, DaveArea.DB,2,96,0),
    IS_HEIGHT_12004("IS_HEIGHT_12004", PlcVar.BOOL,1, DaveArea.DB,2,96,1),
    BARCODE_READ_COMP_12004("BARCODE_READ_COMP_12004", PlcVar.BOOL,1, DaveArea.DB,2,97,1),
    READED_CODE_12004("READED_CODE_12004", PlcVar.STRING,1, DaveArea.DB,2,104,6),
    //12004   结束

    EQ_STATUS_12005("EQ_STATUS_12005", PlcVar.BYTE,1, DaveArea.DB,2,121,0),


    //12006   开始
    RW_FLAG_12006("RW_FLAG_12006", PlcVar.BYTE,1, DaveArea.DB,2,150,0),
    EQ_STATUS_12006("EQ_STATUS_12006", PlcVar.BYTE,1, DaveArea.DB,2,151,0),
    TASK_NO_12006("TASK_NO_12006", PlcVar.INT,1, DaveArea.DB,2,152,0),
    IS_STOCK_12006("IS_STOCK_12006", PlcVar.BOOL,1, DaveArea.DB,2,156,0),
    //12006   结束


    //12007   开始
    RW_FLAG_12007("RW_FLAG_12007", PlcVar.BYTE,1, DaveArea.DB,2,180,0),
    EQ_STATUS_12007("EQ_STATUS_12007", PlcVar.BYTE,1, DaveArea.DB,2,181,0),
    TASK_NO_12007("TASK_NO_12007", PlcVar.INT,1, DaveArea.DB,2,182,0),
    IS_STOCK_12007("IS_STOCK_12007", PlcVar.BOOL,1, DaveArea.DB,2,186,0),
    IS_HEIGHT_12007("IS_HEIGHT_12007", PlcVar.BOOL,1, DaveArea.DB,2,186,1),
    BARCODE_READ_COMP_12007("BARCODE_READ_COMP_12007", PlcVar.BOOL,1, DaveArea.DB,2,187,1),
    READED_CODE_12007("READED_CODE_12007", PlcVar.STRING,1, DaveArea.DB,2,194,6),
    //12007   开始


    //12008   开始
    RW_FLAG_12008("RW_FLAG_12008", PlcVar.BYTE,1, DaveArea.DB,2,210,0),
    EQ_STATUS_12008("EQ_STATUS_12008", PlcVar.BYTE,1, DaveArea.DB,2,211,0),
    TASK_NO_12008("TASK_NO_12008", PlcVar.INT,1, DaveArea.DB,2,212,0),
    IS_STOCK_12008("IS_STOCK_12008", PlcVar.BOOL,1, DaveArea.DB,2,216,0),
    IS_HEIGHT_12008("IS_HEIGHT_12008", PlcVar.BOOL,1, DaveArea.DB,2,216,1),
    BARCODE_READ_COMP_12008("BARCODE_READ_COMP_12008", PlcVar.BOOL,1, DaveArea.DB,2,217,1),
    READED_CODE_12008("READED_CODE_12008", PlcVar.STRING,1, DaveArea.DB,2,224,6),
    //12008   结束

    //12009   开始
    RW_FLAG_12009("RW_FLAG_12009", PlcVar.BYTE,1, DaveArea.DB,2,240,0),
    EQ_STATUS_12009("EQ_STATUS_12009", PlcVar.BYTE,1, DaveArea.DB,2,241,0),
    TASK_NO_12009("TASK_NO_12009", PlcVar.INT,1, DaveArea.DB,2,242,0),
    IS_STOCK_12009("IS_STOCK_12009", PlcVar.BOOL,1, DaveArea.DB,2,246,0),
    IS_HEIGHT_12009("IS_HEIGHT_12009", PlcVar.BOOL,1, DaveArea.DB,2,246,1),
    BARCODE_READ_COMP_12009("BARCODE_READ_COMP_12009", PlcVar.BOOL,1, DaveArea.DB,2,247,1),
    READED_CODE_12009("READED_CODE_12009", PlcVar.STRING,1, DaveArea.DB,2,254,6),
    //12009   结束

    //12010   开始
    RW_FLAG_12010("RW_FLAG_12010", PlcVar.BYTE,1, DaveArea.DB,2,270,0),
    EQ_STATUS_12010("EQ_STATUS_12010", PlcVar.BYTE,1, DaveArea.DB,2,271,0),
    TASK_NO_12010("TASK_NO_12010", PlcVar.INT,1, DaveArea.DB,2,272,0),
    IS_STOCK_12010("IS_STOCK_12010", PlcVar.BOOL,1, DaveArea.DB,2,276,0),
    IS_HEIGHT_12010("IS_HEIGHT_12010", PlcVar.BOOL,1, DaveArea.DB,2,276,1),
    BARCODE_READ_COMP_12010("BARCODE_READ_COMP_12010", PlcVar.BOOL,1, DaveArea.DB,2,277,1),
    READED_CODE_12010("READED_CODE_12010", PlcVar.STRING,1, DaveArea.DB,2,284,6),
    //12010   结束

    EQ_STATUS_12011("EQ_STATUS_12011", PlcVar.BYTE,1, DaveArea.DB,2,301,0),


    //12012   开始
    RW_FLAG_12012("RW_FLAG_12012", PlcVar.BYTE,1, DaveArea.DB,2,330,0),
    EQ_STATUS_12012("EQ_STATUS_12012", PlcVar.BYTE,1, DaveArea.DB,2,331,0),
    TASK_NO_12012("TASK_NO_12012", PlcVar.INT,1, DaveArea.DB,2,332,0),
    IS_STOCK_12012("IS_STOCK_12012", PlcVar.BOOL,1, DaveArea.DB,2,336,0),
    //12012   结束


    DOOR_12001("DOOR_12001", PlcVar.BYTE,1, DaveArea.DB,2,361,0),
    DOOR_12007("DOOR_12007", PlcVar.BYTE,1, DaveArea.DB,2,391,0),


    ;

    private String name;
    private DaveArea area;
    private Integer areaNumber;
    private Integer byteOffset;
    private Integer bitOffset;
    private PlcVar type;
    //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度，和read操作相关
    //如果是String 类型不用填length 只需要填string类型的起始位置就行了，我会自己去取数据长度（也就是说这里的length并不是string 的长度）。
    private Integer length;

    //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度
    private Integer strSize;

    Plc2WcsVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = 0;
    }
    Plc2WcsVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = strSize;
    }

    public Integer getStrSize() {
        return strSize;
    }

    public void setStrSize(Integer strSize) {
        this.strSize = strSize;
    }

    public String getName() {
        return name;
    }

    public DaveArea getArea() {
        return area;
    }

    public Integer getAreaNumber() {
        return areaNumber;
    }

    public Integer getBitOffset() {
        return bitOffset;
    }

    public Integer getByteOffset() {
        return byteOffset;
    }

    public PlcVar getType() {
        return type;
    }

    public Integer getLength() {
        return length;
    }
}
